<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Weba Novare</title>
        <link rel="stylesheet" type="text/css" href="css/style.css" />
        <script type="text/javascript" src="client/js/lib/jquery-1.7.1.min.js"/>
        <script type="text/javascript" src="client/js/gui/popup.js"/>
        <script type="text/javascript" src="client/js/gui/popupLogin.js"/>
    </h:head>
    <h:body>
        <ui:include src="/template/header.xhtml" />
        <c:choose>
            <c:when test="#{auth.loggedIn}">
                <f:metadata>
                    <f:viewParam id="username" name="username" value="#{userBB.username}" />        
                </f:metadata>
                <div class="mainContent">
                    <div id="profile">
                        <h1 style="border-bottom: 1px dotted #FF9A00;"><h:outputText value="PROFILE FOR #{userBB.username}"/></h1><br /><br />

                        <label style="border-bottom: 1px dotted #FF9A00;">PLAYED GAMES</label> <br/><br/>
                        <table id="resultTable" align="center">
                            <tr>
                                <td>
                                    <table>
                                        <c:forEach var="game" items="#{userBB.gamesToString}">
                                            <tr>
                                                <td>
                                                    #{game}
                                                </td>
                                            </tr>    
                                        </c:forEach>
                                    </table>
                                </td>
                                <td>
                                    <table>
                                        <c:forEach var="gid" items="#{userBB.gameIds}">
                                            <tr>
                                                <td>
                                                    <h:link styleClass="profileLink" value="view details" outcome="playedgame">
                                                        <f:param name="id" value="#{gid}"></f:param>
                                                    </h:link>
                                                </td>
                                            </tr>    
                                        </c:forEach>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </c:when>
            <c:otherwise>
                <div class="mainContent">
                    You are not logged in.
                </div>
            </c:otherwise>
        </c:choose>
    </h:body>
</html>
